package Test.Test02;


import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @Author: kirito
 * @Date: 2024/3/31 15:05
 * @Description:
 */

public class distribution {
    public static void main(String[] args) {
        List<Integer> list = IntStream.rangeClosed(1, 100)
                .boxed()
                .collect(Collectors.toList());
//        System.out.println(list);
        Map<Integer,List<Integer>> res = dis(list);
        List<Integer> list1 = res.get(1);
        List<Integer> list2 = res.get(2);
        System.out.println(list1);
        System.out.println(list1.size());
        System.out.println(list2);
        System.out.println(list2.size());
    }

    private static Map<Integer,List<Integer>> dis(List<Integer> list) {
        Map<Integer, List<Integer>> map = new HashMap<>();
        //1上海员工，2线上
        List<Integer> list1 = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        Random random = new Random();
        for (Integer i : list) {
            int ran = random.nextInt(5);
            if (ran <= 2) {
                list1.add(i);
            } else {
                list2.add(i);
            }
        }
        map.put(1, list1);
        map.put(2, list2);
        return map;
    }
}

